// pages/search_result/search_result.js
const db = wx.cloud.database();
const _ = db.command
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    shop:null,
    shop_num:0 
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.name);
    let that=this;
    let name = options.name;
    db.collection('users').where({
      name: name
    }).get().then(res => {
      // res.data 包含该记录的数据
      console.log(res.data);
      that.setData({
        shop: res.data,
        shop_num:res.data.length
      })
    
    })
  },
  //去详细页面
  tomore: function (e) {
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '../shop_info/shop_info?id=' + id
    })
  }
})